﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace H
{
	// Token: 0x02000268 RID: 616
	internal class H_State_PreTouchWait : H_State
	{
		// Token: 0x06001033 RID: 4147 RVA: 0x00067DCC File Offset: 0x00065FCC
		public H_State_PreTouchWait(H_Members members) : base(members)
		{
		}

		// Token: 0x06001034 RID: 4148 RVA: 0x00067DD8 File Offset: 0x00065FD8
		public override void In(H_State.Message msg)
		{
			float blend = H_State.BlendMessage.GetBlend(msg, 0f);
			this.members.PlayAnime("Wait", blend);
			this.leaveTimer = 0f;
			this.members.MaleExpression(H_Expression_Male.TYPE.NORMAL);
			this.leave = false;
			this.endInVoice = false;
		}

		// Token: 0x06001035 RID: 4149 RVA: 0x00067E28 File Offset: 0x00066028
		public override void Main()
		{
			this.leaveTimer += Time.deltaTime;
			if (!this.leave && this.leaveTimer >= 10f)
			{
				int femaleNo = UnityEngine.Random.Range(0, this.members.GetFemales().Count);
				this.members.VoiceExpression(femaleNo, H_Voice.TYPE.LEAVING);
				this.leave = true;
			}
			this.UpdateVoice();
			if (this.endInVoice && this.members.h_scene.MixCtrl.mode == MixController.MODE.FULL_AUTO)
			{
				base.ChangeState(H_STATE.LOOP);
			}
		}

		// Token: 0x06001036 RID: 4150 RVA: 0x00067EC4 File Offset: 0x000660C4
		private void UpdateVoice()
		{
			List<Female> females = this.members.GetFemales();
			for (int i = 0; i < females.Count; i++)
			{
				if (!females[i].IsVoicePlaying())
				{
					this.members.VoiceExpression(i, H_Voice.TYPE.BREATH);
					this.endInVoice = true;
				}
			}
		}

		// Token: 0x06001037 RID: 4151 RVA: 0x00067F1C File Offset: 0x0006611C
		public override void OnInput(H_INPUT input)
		{
			if (input == H_INPUT.CLICK_PAD)
			{
				base.ChangeState(H_STATE.LOOP);
			}
		}

		// Token: 0x04001177 RID: 4471
		private const float leaveTime = 10f;

		// Token: 0x04001178 RID: 4472
		private float leaveTimer;

		// Token: 0x04001179 RID: 4473
		private bool leave;

		// Token: 0x0400117A RID: 4474
		private bool endInVoice;
	}
}
